import { ReactElement } from 'react'
import { InputProps } from '../Input/types'

export interface AutoCompleteProps extends Omit<InputProps, 'onSelect'> {
	fetchSuggestions: (
		keyword: string
	) => DataSourceType[] | Promise<DataSourceType[]>
	onSelect?: (item: DataSourceType) => void
	renderOption?: (item: DataSourceType) => ReactElement
}

interface DataSourceObject {
	value: string
}

export type DataSourceType<T = {}> = T & DataSourceObject
